import {
    request, comm_request
} from "@/api/request.js"

const BASE_URL = 'https://ai-api.ytaiccg.com/api/auth';
// const BASE_URL = 'https://ai-api.banjiajia.com/api/auth';

//短信发送
/**
 * @constructor
 * @param {String} cellphone 账号 -  required
 * @@param {String}  type 短信类型(注册-reg; 登录-login; 改密码-password; 修改手机-changephone) - required
 */
const apiSmsSend = (data = {}) => {
    return request({
        url: BASE_URL + "/sms_send",
        data,
        method: "POST",
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })
}

//登录
/**
 * @constructor
 */
const apiResetPassword = (data = {}) => {
    return request({
        url: BASE_URL + "/yuntu/password",
        data,
        method: "POST"
    })
}

//忘记密码
/**
 * @constructor
 */
const apiLoginApi = (data = {}) => {
    return request({
        url: BASE_URL + "/yuntu/get_token",
        data,
        method: "POST"
    })
}

//注册账号
/**
 * @constructor
 */
const apiRegisterApi = (data = {}) => {
    return request({
        url: BASE_URL + "/yuntu/register",
        data,
        method: "POST"
    })
}

//获取用户信息
/**
 * @constructor
 */
const apiGetUserInfo = (data = {}) => {
    return request({
        url: BASE_URL + "/yuntu/user/info",
        data
    })
}

//微信浏览器内支付前获取code的请求
/**
 * @constructor
 */
const apiGetWchatCode = (data = {}) => {
    return request({
        url: BASE_URL + "/wx_pay?goodsId=" + data.goodsId
    })
}


//修改名称
/**
 * @constructor
 */
const apiChangeUserName = (data = {}) => {
    return request({
        url: BASE_URL + "/yuntu/user/changename",
        data,
        method: "POST"
    })
}

//获取全世界国家的手机号码前缀
/**
 * @constructor
 */
const apiCountrycode = (data = {}) => {
    return request({
        url: BASE_URL + "/countrycode",
        data,
        method: "GET"
    })
}


//获取权限
/**
 * @constructor
 */
const apiCheckToken = (data = {}) => {
	// console.log(data,'-----data--');
    return comm_request({
        url: BASE_URL + "/oauth/check_token?token=" + data
    })
}




export {
    apiSmsSend,             //短信发送
    apiLoginApi,            //登录
    apiResetPassword,       //忘记密码
    apiRegisterApi,         //注册账号
    apiGetUserInfo,         //获取用户信息  
    apiGetWchatCode,        //微信浏览器内支付前获取code的请求
	apiChangeUserName,		//修改名称
    apiCountrycode,         //获取全世界国家的手机号码前缀
	apiCheckToken, 			//获取权限
}